---@class UIDarkStreetDead : UIBase
UIDarkStreetDead = UIBase.New(PanelResNames.UIDarkStreetDead)
local t = UIDarkStreetDead

function t.Init(time)
    t.maxTime = time
    UIBase.Init(t)
end

function t:OnCreate()
    self.playerNameText = self:GetChild("Text_PlayerName")
    self.numText = self:GetChild("Text_RewardNum")
    self.countDownText = self:GetChild("Text_CountDown")
    self.effCountDown = self:GetTransition("Effect_CountDown")
    self.Btn_DeadTips = self:GetChild("Btn_DeadTips")
    self.Text_SmallTips = self:GetChild("Text_SmallTips",self.Btn_DeadTips)
    self:RegisterOnClick(self.Btn_DeadTips,self.RefreshTip)
    AudioManager.Play(2035)
end

function t:OnEnable()
    self:Refresh()
    self:RefreshTip()
end
function t:OnDisable()
    self:RemoveTimeCall(self.UpdateTime)
end
function t:OnDestroy()
end
function t:Refresh()
    self.time = t.maxTime
    local mgr = logicMgr.DarkStreetMgr
    self.playerNameText.text = mgr.attackMeName
    self.numText.text = mgr.lostCount
    --self.effCountDown:Play()
    self.countDownText.text = string.format(getLanguage("DarkLaneTipes_1"),self.time) --复活中：%d
    self:TimeCall(self.UpdateTime,100,-1)
end
function t:UpdateTime()
    self.time = self.time - 0.1
    if self.time < 0 then
        self.time = 0
    end
    self.countDownText.text = string.format(getLanguage("DarkLaneTipes_1"),math.floor(self.time))--复活中：%d
end
function t:RefreshTip()
    local id = math.random(30,39)
    self.Text_SmallTips.text = getLanguage("DarkLaneTipes_"..id)
end
return t